package com.gitee.sys.config;


import com.gitee.sys.filter.OriginFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean originFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(originFilter());
        registration.addUrlPatterns("/*");
        registration.setName("OriginFilter");
        registration.setOrder(9);
        return registration;
    }

   /* @Bean
    public FilterRegistrationBean jwtFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(jwtFilter());
        registration.addUrlPatterns("/*");
        //registration.addInitParameter("paramName", "paramValue");
        registration.setName("jwtFilter");
        registration.setOrder(10);
        return registration;
    }
*/
   /* @Bean
    public Filter jwtFilter() {
        return new JwtFilter();
    }*/

    @Bean
    public Filter originFilter() {
        return new OriginFilter();
    }

}
